Repository navigation
fix(sdk-coin-eth): enforce strict ERC-7984 delegation verification on test/staging (CECHO-2720) - #10191
Conversation
|
|
|
@claude review |
|
Claude finished @nvrakesh06's task in 27s —— View job Review of PR #10191 (CECHO-2720 strict ERC-7984 delegation verification)I read the diff of the three source files ( Main concern
Correctness and robustness
Style and docs
Tests The 15 new cases cover the key scenarios, including the prod gate in both directions. Two cases I'd add:
Rollout Release N is env-gated and prod behavior is unchanged, so the risk of merging is low. Because the delegate pin is the strongest control and it is dormant, please keep CECHO-2720 open until the real addresses are pinned and N+1 removes the gate. I made no code changes. |
… test/staging (CECHO-2720) Adds a fail-closed strict verification tier for ERC-7984 enable-token prebuilds, enforced when bitgo.env is test or staging; prod keeps legacy behavior for one release cycle (the env gate is removed in Release N+1, tracked in CECHO-2720). - abstract-eth: new decodeDelegationCallsFromCalldata surfaces the delegate and expiry of every inner delegateForUserDecryption call and the callFromParent target/value, and fails closed on any inner multicall entry that is not a well-formed delegation call (no smuggled calls). The legacy decoder is unchanged. - sdk-coin-eth: verifyEnableTokenTransaction strict mode requires an exact deduplicated token-set match, a single consistent delegate equal to the pinned enterprise viewing key (fail closed when no pin exists), a future expiry, and callFromParent target == ACL contract with zero native value (blocks forwarder fund exfiltration). - statics: optional EthereumNetwork.zamaViewingKeyAddress pins the BitGo enterprise viewing key per network; the real values for mainnet and Hoodi are a hard prerequisite for Release N. Addresses the Claude review findings on PR #10191: fail-closed without a pinned viewing key, and set-based token matching so duplicate requested tokens cannot smuggle unrequested tokens. The multisig enable-token path is a pre-existing gap tracked separately as CECHO-2815.
787d426 to
fe6c02f
Compare
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
|
Two findings from the claude review on the stacked #10192 (CECHO-2719) apply to this PR's code, not 2719 — flagging here so they land with the commits that introduced them:
The |
Description
Fixes the client-side verification gap from CECHO-2720:
Erc7984Token.verifyEnableTokenTransactionvalidated only the token contract addresses inside an enable-token prebuild and ignored every other security-relevant field of the delegation calldata, allowing a compromised platform to substitute the decryptiondelegate, smuggle extra ACL calls inside the multicall, or wrap a theft prebuild incallFromParent.What this PR does (env-gated on
bitgo.env === 'test' || 'staging'; prod keeps legacy behavior for one release cycle):feat(abstract-eth)): newdecodeDelegationCallsFromCalldatasurfaces per-calldelegate/expiryandcallFromParenttarget/value, and rejects any inner multicall entry that is not a well-formeddelegateForUserDecryptioncall (unknown selector or trailing bytes). The legacydecodeTokenAddressesFromDelegationCalldatais untouched.fix(sdk-coin-eth)): on test/staging,verifyEnableTokenTransactionnow requires exact token-set match against the requested tokens, a single consistent delegate, a future expiry, and for the forwarder shapecallFromParenttarget == ACL contract with zero native value — which blocks the forwarder fund-exfiltration prebuild from the ticket. ThetxJson.towallet-owned-forwarder check is not statically verifiable client-side; the on-chainonlyParentmodifier plus the enforced target/value checks close the theft vector regardless of the forwarder addressed.fix(statics)): new optionalEthereumNetwork.zamaViewingKeyAddress. When pinned, the verifier rejects any delegation whose delegate is not the BitGo enterprise viewing key.Rollout plan (tracked in CECHO-2720): this is Release N — strict checks on test/staging only, prod unchanged (no prod rollback concern: prod behavior in this release is identical to current). After staging/testnet validation of real enable-token flows (both delegation shapes, TSS and rebuild signing), Release N+1 removes the env gate and enforces everywhere, published as a minor bump. The ticket must not be closed after Release N alone.
Issue Number
CECHO-2720
Type of change
How Has This Been Tested?
Unit tests — 15 new cases in
modules/sdk-coin-eth/test/unit/erc7984Token.ts:ACL.approve) rejectedcallFromParent(attackerContract, forwarderBalance, multicall)) rejectedcallFromParentwith non-zero native value rejectedstagingenv as well astestenv === 'prod'(legacy path), demonstrating the gate works in both directionscallFromParenttarget/value, unknown-selector throw, trailing-bytes throwFull-module runs:
modules/sdk-coin-eth574 passing,modules/abstract-eth188 passing,modules/statics42,051 passing — zero failures.Reproduce:
cd modules/sdk-coin-eth && npx mocha(alsomodules/abstract-eth,modules/statics).Remaining pre-GA work (per the ticket): exercise real enable-token flows against staging/testnet in strict mode before Release N+1 removes the gate.
Checklist